package cn.sunshuai.feignclient;

import cn.sunshuai.domain.Movie;
import cn.sunshuai.domain.MovieUser;
import cn.sunshuai.util.AjaxResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(value = "movie-server",fallbackFactory = MovieFeignClientFallbackFactory.class)
public interface MovieFeignClient {

    @GetMapping
    public List<Movie> findAll();

    @GetMapping("/{id}")
    public Movie movieBuy(@PathVariable("id") Long id);

    @PutMapping
    public AjaxResult addOrUpdate(@RequestBody MovieUser movieUser);

    @PostMapping
    AjaxResult addOrUpdateMovie(@RequestBody Movie movie);

    @GetMapping("/movieUser/{id}")
    MovieUser findByMovieId(@PathVariable("id") Long id);
}
